﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Management.Automation.Host;

namespace Evaluant.PS4VS.Renderer
{
    class VSHostRawUI : PSHostRawUserInterface
    {
        MyToolWindow window;

        public VSHostRawUI(MyToolWindow window)
        {
            this.window = window;
        }

        public override ConsoleColor BackgroundColor
        {
            get
            {
                return window.InnerControl.BackColor.ToConsoleColor();
            }
            set
            {
                window.InnerControl.BackColor = value.ToDrawingColor();
            }
        }

        public override Size BufferSize
        {
            get { return new Size(window.InnerControl.SizeInCharacters.Width, window.InnerControl.SizeInCharacters.Height); }
            set { throw new NotImplementedException(); }
        }

        public override int CursorSize
        {
            get
            {
                throw new NotImplementedException();
            }
            set
            {
                throw new NotImplementedException();
            }
        }

        public override void FlushInputBuffer()
        {
            window.InnerControl.WriteLine(">>>>>> Flush Called");
        }

        public override ConsoleColor ForegroundColor
        {
            get
            {
                return window.InnerControl.ForeColor.ToConsoleColor();
            }
            set
            {
                window.InnerControl.ForeColor = value.ToDrawingColor();
            }
        }

        public override BufferCell[,] GetBufferContents(Rectangle rectangle)
        {
            throw new NotImplementedException();
        }

        public override bool KeyAvailable
        {
            get { throw new NotImplementedException(); }
        }

        public override Size MaxPhysicalWindowSize
        {
            get { throw new NotImplementedException(); }
        }

        public override Size MaxWindowSize
        {
            get { throw new NotImplementedException(); }
        }

        public override KeyInfo ReadKey(ReadKeyOptions options)
        {
            throw new NotImplementedException();
        }

        public override void ScrollBufferContents(Rectangle source, Coordinates destination, Rectangle clip, BufferCell fill)
        {
            throw new NotImplementedException();
        }

        public override void SetBufferContents(Rectangle rectangle, BufferCell fill)
        {
            throw new NotImplementedException();
        }

        public override void SetBufferContents(Coordinates origin, BufferCell[,] contents)
        {
            throw new NotImplementedException();
        }

        public override Coordinates WindowPosition
        {
            get
            {
                throw new NotImplementedException();
            }
            set
            {
                throw new NotImplementedException();
            }
        }

        public override Size WindowSize
        {
            get
            {
                return new Size(window.InnerControl.Size.Width, window.InnerControl.Size.Height);
            }
            set
            {
                throw new NotImplementedException();
            }
        }

        public override string WindowTitle
        {
            get
            {
                return window.Caption;
            }
            set
            {
                window.Caption = value;
            }
        }

        public override Coordinates CursorPosition
        {
            get
            {
                throw new NotImplementedException();
            }
            set
            {
                throw new NotImplementedException();
            }
        }
    }
}
